package mylibrary.io;

import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;

public class DirFilter implements FilenameFilter {

	private Pattern pattern;
	
	public DirFilter() {
		
	}
	
	public DirFilter(String regex) {
		pattern = Pattern.compile(regex);
	}

	public boolean accept(File dir, String name) {
		
		//return pattern.matcher(new File(name).getName()).matches();
		
		//System.out.println(dir);
		if(name.indexOf('a') != -1) {
			return true;
		}
		return false;
	}

}
